package cn.hrlly.tao2shou.presenter;

import cn.hrlly.tao2shou.biz.ConfirmApplicationBiz;
import cn.hrlly.tao2shou.biz.ConfirmApplicationBizImpl;
import cn.hrlly.tao2shou.domain.Applications;
import cn.hrlly.tao2shou.listener.OnConfimApplicationListener;
import cn.hrlly.tao2shou.view.view_interface.ConfirmApplicationView;

/**
 * User: gengliang
 * Date: 2016-01-31
 * Time: 10:35
 */

public class ConfirmApplicationPresenterImpl implements ConfirmApplicationPresenter,OnConfimApplicationListener {

    private ConfirmApplicationBiz confirmApplicationBiz;
    private ConfirmApplicationView confirmApplicationView;

    public ConfirmApplicationPresenterImpl(ConfirmApplicationView confirmApplicationView){
        this.confirmApplicationBiz=new ConfirmApplicationBizImpl(this);
        this.confirmApplicationView=confirmApplicationView;
    }

    @Override
    public void confirmApplication() {
        Applications applications=new Applications();
        applications.setApplicationId(confirmApplicationView.getApplicationId());
        confirmApplicationBiz.confirmApplication(applications);
    }

    @Override
    public void confirmApplicationSucc(String message) {
        confirmApplicationView.showMessage(message);
        confirmApplicationView.finishActivity();
    }

    @Override
    public void confirmApplicationSucc(int message) {
        confirmApplicationView.showMessage(message);
        confirmApplicationView.finishActivity();
    }

    @Override
    public void confirmApplicationFail(String errorMessage) {
        confirmApplicationView.showMessage(errorMessage);
    }

    @Override
    public void confirmApplicationFail(int errorMessage) {
        confirmApplicationView.showMessage(errorMessage);
    }
}
